package cn.wjx.taobaounion.base;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * @author WuChangJian
 * @date 2020/6/22 20:22
 */
public abstract class BaseActivity extends AppCompatActivity {

    private Unbinder mBind;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutResId());
        //==================清明节灰色UI效果=======================
        // View decorView = this.getWindow().getDecorView();
        // ColorMatrix cm = new ColorMatrix();
        // cm.setSaturation(0);
        // Paint paint = new Paint();
        // paint.setColorFilter(new ColorMatrixColorFilter(cm));
        // decorView.setLayerType(View.LAYER_TYPE_SOFTWARE,paint);
        //==================清明节灰色UI效果=======================
        mBind = ButterKnife.bind(this);
        initView();
        initEvent();
        initPresenter();
    }

    protected void initPresenter() {

    }

    protected abstract int getLayoutResId();

    /**
     * 根据需求覆盖
     */
    protected void initView() {

    }

    protected void initEvent() {

    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mBind != null) {
            mBind.unbind();
        }
        release();
    }

    protected void release() {

    }
}
